#include "widget.h"
#include "ui_widget.h"
#include "mypushbutton.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    QPushButton quit ( "Quit" ) ;
    QWidget window ;
    quit.setParent ( &window) ;

    // MyPushButton *btn = new MyPushButton;
    // btn->setText("我的按钮");
    // btn->setParent(this); //设置到对象树中，当窗口关闭时就会自动调用其析构函数
}

Widget::~Widget()
{
    qDebug() << "Widget的析构函数被调用";
    delete ui;
}
